#!/usr/bin/python
# -*- coding:UTF8 -*-
import re

import requests
from lxml import etree

# 获取数据
url = 'https://www.jkl.com.cn/newsList.aspx?TypeId=10009'
user_agent = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36'}
r = requests.get(url=url, headers=user_agent).text
Analytical_data = etree.HTML(r)
# print(Analytical_data)
tail = Analytical_data.xpath('//a[text()="尾页"]/@href')
# print(tail)
if tail != []:
    regular = re.search('(\d+)', tail[0])
    page = regular.group(1)
else:
    page = 1
print(page)
